const webpack = require('webpack')
const path = require('path')
const merge = require('webpack-merge')
const DashboardPlugin = require('webpack-dashboard/plugin');
const baseWebpackConfig = require('./webpack.base')
module.exports = merge.smart(baseWebpackConfig, {
  mode: 'development',
  devServer: {
    publicPath: '/', // 这里指静态资源服务路径 /img/0.png
    hot: true,
    open: true,
    quiet: true, // webpack-dashboard 代替打印 log
    contentBase: './dist'
  },
  output: {
    // 由JS或者CSS间接请求资源的路径。指定这部分间接资源的请求位置
    publicPath: '/'  // 斜杠代表路径以此时host.name为基础的
  },
  devtool: 'cheap-module-source-map', // 属于打包速度和源码信息还原程度的良好折中
  plugins: [
    new DashboardPlugin(),
    new webpack.HotModuleReplacementPlugin()
  ]
})